<?php $post = $this->get('post');?>

<form method="post" action="<?php _e(actionUrl($this))?>" onsubmit="return ajax_form(this)" id="task-form" enctype="multipart/form-data">
<input type="hidden" name="diploma_id" value="<?php _e($this->get('diploma_id'))?>"/>
<div class="x-list-title">
		<table width="100%" border="0" height="100%">
			<tr>
				<td align="left">
					<h2>
						Tạo công văn đi 
					</h2>
				</td>
				<td align="right">	
					<div class="x-list-options">
						
					</div>
				</td>
			</tr>
			</table>	
		</div>
<div class="x-form-container">
	<div class="form-message"></div>
	<table width="100%" cellpadding="4" class="x-form">
		<tr>
			<td class="x-form-label" >Loại công văn : </td>
			<td class="x-form-input">
				<select name="subtype" class="x-select">
				<?php $type = $this->get("type");
					foreach ($type as $k=>$v){
						?>
						<option value="<?php _e($v['ID']);?>"><?php _e($v['title']);?></option>
						<?php
					}
				?>
				</select>
				<input type="hidden" value="2" name="type">
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Số hiệu : </td>
			<td class="x-form-input">
				<input class="x-text" type="text" name="code"  value="<?php _e($post["code"]);?>"/>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Ngày gửi : </td>
			<td class="x-form-input">
				<input class="x-text x-date" type="text" name="date_send" onclick="date_picker(this,{noTime:true})" value="<?php _e($post['date_send'])?>"/>
				&nbsp;&nbsp;&nbsp;&nbsp;
				<b>Ngày phát hành</b>
				<input class="x-text x-date" type="text" name="date_enactment" onclick="date_picker(this,{noTime:true})" value="<?php _e($post['date_enactment'])?>"/>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Cơ quan ban hành : </td>
			<td class="x-form-input">
				<input class="x-text" type="text" name="ogran_by" style="width:400px;" value="<?php _e($post['ogran_by'])?>"/>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Trích yếu : </td>
			<td class="x-form-input">
				<textarea name="abstracts" class="x-text" rows="5" style="width:605px;" cols="40" ><?php _e($post["abstracts"]);?></textarea>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Người tạo : </td>
			<td class="x-form-input">
				<?php 
				_e(get_user_link($this->get('users')))?>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Gửi để xem : </td>
			<td class="x-form-input">
				<div class="x-select-users" x-name="usersGet[]" x-title="Gửi xem">
				<?php
					$usersGet = $this->get('usersGet');
					if(!$usersGet){
					}else{
					foreach($usersGet as $user ){?>
					<span class="item">
						<input type="hidden" name="usersGet[]" value="<?php _e($user['ID'])?>"><a><?php _e($user['username'])?></a><span class="close">x</span>
					</span>
				<?php }};?>	
				</div>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Mức độ ưu tiên xử lý : </td>
			<td class="x-form-input">
				<input type="radio" value="1" class="x-radio"<?php if($post['prior'] ==1){_e(' checked');}else{_e('');}?> name="prior"><span class="p-low">Thấp</span>
				<input type="radio" value="2" class="x-radio"<?php if($post['prior'] ==2){_e(' checked');}else{_e('');}?> name="prior"><span class="p-normal">Bình thường</span>
				<input type="radio" value="3" class="x-radio"<?php if($post['prior'] ==3){_e(' checked');}else{_e('');}?> name="prior"><span class="p-hight">Cao</span>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Ghi chú : </td>
			<td class="x-form-input">
				<textarea name="desc" class="x-text" style="width:605px;" rows="5" cols="40"><?php _e($post['desc']);?></textarea>
			</td>
		</tr>
		<tr>
			<td class="x-form-label"><span class="x-attachment"></span></td>
			<td class="x-form-input">
				<td class="x-form-input" colspan="2">
				<?php foreach( $this->get('files') as $file ):?>
				
				<div class='x-file-info'>
					<input checked type='checkbox' name='files[]' value='<?php _e($file['ID']);?>'/>
					<a href="<?php _ctrUrl($this);?>/File?ID=<?php _e($file['ID']);?>" target="_blank"><?php _e($file['filename']);?> <?php _e($file['size']);?> KB	</a>
					</div>
					<?php endforeach;?>
					<div class="x-files" url="<?php _baseUrl();?>/Diploma/Indexs/Upload?ID=<?php _e($this->get('diploma_id')); ?>" post_id="<?php _e($post['ID'])?>"></div>
				</td>
			</td>
		</tr>
		<tr>
			<td class="x-form-label"></td>
			<td>
				<input type="submit" value="<?php if(isset($post['code'])){_e('Sửa công văn');}else{_e('Thêm công văn');}?>" class="x-button x-save"/>
				<a href="#Diploma?type=2"  class="x-button x-fresh">Hủy bỏ</a>
			</td>
		</tr>
	</table>
</div>
</form>